import execjs,os,requests

with open("1.js", 'r', encoding='utf-8') as f:
    data = f.read()
os.environ["EXECJS_RUNTIME"] = "Node"
print(execjs.get().name)
# 执行js脚本，获取返回值 url
context1 = execjs.compile(data) #Node.js (V8)
user_uuid = context1.call("generateUUID2")
print(user_uuid)

headers = {
    "Cookie":"user_uuid="+str(user_uuid),
"Sec-Ch-Ua":'"Google Chrome";v="123", "Not":""A-Brand";v="8", "Chromium";v="123"',
"Sec-Ch-Ua-Mobile":"?0",
"Sec-Ch-Ua-Platform":"Windows",
"Sec-Fetch-Dest":"empty",
"Sec-Fetch-Mode":"cors",
"Sec-Fetch-Site":"cross-site",
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",

}


url = "https://missav.com/dm26/cn/miab-147-chinese-subtitle"

# headers ={
# # "authority":"surrit.com",
# # "method":"GET",
# # "path":"/1fdd4fd6-2edc-4062-891c-987dadaca395/720p/video14.jpeg",
# "scheme":"https",
# "Accept":"*/*",
# "Accept-Encoding":"gzip, deflate, br, zstd",
# "Accept-Language":"zh-CN,zh;q=0.9",
# "Dnt":"1",
# "Origin":"https://missav.com",
# "Referer":"https://missav.com/dm26/cn/miab-147-chinese-subtitle",
# "Sec-Ch-Ua":'"Google Chrome";v="123", "Not":""A-Brand";v="8", "Chromium";v="123"',
# "Sec-Ch-Ua-Mobile":"?0",
# "Sec-Ch-Ua-Platform":"Windows",
# "Sec-Fetch-Dest":"empty",
# "Sec-Fetch-Mode":"cors",
# "Sec-Fetch-Site":"cross-site",
# "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
# }

print(headers)

res = requests.get(url=url,headers=headers)


print(res.status_code)
print(res.text)

with open("4.html",'w',encoding='utf8') as f:
    f.write(res.text)